import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StudentAttendanceRecordVO, StudentAttendanceRecordForm, StudentAttendanceRecordQuery } from '@/api/attendance/student/record/types';

/**
 * 查询学生考勤记录列表
 * @param query
 * @returns {*}
 */

export const listStudentAttendanceRecord = (query?: StudentAttendanceRecordQuery): AxiosPromise<StudentAttendanceRecordVO[]> => {
  return request({
    url: '/attendance/student/record/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询学生考勤记录详细
 * @param id
 */
export const getStudentAttendanceRecord = (id: string | number): AxiosPromise<StudentAttendanceRecordVO> => {
  return request({
    url: '/attendance/student/record/' + id,
    method: 'get'
  });
};

/**
 * 新增学生考勤记录
 * @param data
 */
export const addStudentAttendanceRecord = (data: StudentAttendanceRecordForm) => {
  return request({
    url: '/attendance/student/record',
    method: 'post',
    data: data
  });
};

/**
 * 修改学生考勤记录
 * @param data
 */
export const updateStudentAttendanceRecord = (data: StudentAttendanceRecordForm) => {
  return request({
    url: '/attendance/student/record',
    method: 'put',
    data: data
  });
};

/**
 * 删除学生考勤记录
 * @param id
 */
export const delStudentAttendanceRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/attendance/student/record/' + id,
    method: 'delete'
  });
};
